home *** CD-ROM | disk | FTP | other *** search
- /* © 1988, Bowers Development Corp. */
- /* Windowing.c */
-
- #include "Globals.h"
- #include "Scrolling.h"
- #include "Miscellany.h"
- #include "FileM.h"
- #include "Dispatcher.h"
-
- #include "Windowing.h"
-
- /*----------*/
- void DoContent (whichWindow)
- WindowPtr whichWindow;
- {
- Point where;
- ControlHandle whichControl;
- short partCode;
- Boolean extendSel;
-
- if (whichWindow != FrontWindow ()) {
- SelectWindow (whichWindow);
- } else {
- where = curEvent.where;
- GlobalToLocal (&where);
-
- partCode = FindControl (where, whichWindow, &whichControl);
-
- if (whichControl == nil) {
- extendSel = ((curEvent.modifiers & shiftKey) != 0);
- if ((cur->text != nil)
- && PtInRect (where, &((**(cur->text)).viewRect))) {
- TEClick (where, extendSel, cur->text);
- } else {
- MouseInContent (where, curEvent.modifiers);
- }
- } else {
- if ((whichControl == cur->vScroll)
- || (whichControl == cur->hScroll)) {
- TrackScroll (whichControl, partCode, where, (ProcPtr) &ScrollWindow);
- } else {
- DoControl (whichControl, partCode, where);
- }
- }
- }
- } /*DoContent*/
-
- /*----------*/
- void DoDrag (whichWindow)
- WindowPtr whichWindow;
- {
- Rect limitRect;
-
- limitRect = (**(GetGrayRgn ())).rgnBBox;
- DragWindow (whichWindow, curEvent.where, &limitRect);
- } /*DoDrag*/
-
- /*----------*/
- void InvalGrowBox (WindowPtr whichWindow);
- void InvalGrowBox (whichWindow)
- WindowPtr whichWindow;
- {
- Rect growBox;
-
- #define port whichWindow->portRect
- SetRect (&growBox, port.right - 15, port.bottom - 15,
- port.right, port.bottom);
- InvalRect (&growBox);
- #undef port
- } /*InvalGrowBox*/
-
- /*----------*/
- void DoGrow (whichWindow)
- WindowPtr whichWindow;
- {
- #define minWidth 55
- #define minHeight 55
- #define maxint 32767
-
- short maxWidth;
- short maxHeight;
- Rect sizeRect;
- long newSize;
- short newWidth;
- short newHeight;
-
- sizeRect = (**(GetGrayRgn ())).rgnBBox;
- maxWidth = (sizeRect.right - sizeRect.left);
- maxHeight = (sizeRect.bottom - sizeRect.top) - MBarHeight;
-
- SetRect (&sizeRect, minWidth, minHeight, maxint, maxint);
- newSize = GrowWindow (whichWindow, curEvent.where, &sizeRect);
- if (newSize != 0) {
- InvalGrowBox (whichWindow); /* old position */
- newWidth = LoWord (newSize);
- newHeight = HiWord (newSize);
- SizeWindow (whichWindow, newWidth, newHeight, true);
- ResizeContent ();
- ResizeScrollBars ();
- InvalGrowBox (whichWindow); /* new position */
- }
- } /*DoGrow*/
-
- /*----------*/
- void DoGoAway (whichWindow)
- WindowPtr whichWindow;
- {
- if (TrackGoAway (whichWindow, curEvent.where)) {
- DoClose ();
- }
- } /*DoGoAway*/
-
- /*----------*/
- void DoZoom (whichWindow, inOrOut)
- WindowPtr whichWindow;
- short inOrOut;
- {
- if (TrackBox (whichWindow, curEvent.where, inOrOut)) {
- EraseRect (&whichWindow->portRect);
- ZoomWindow (whichWindow, inOrOut, false);
- InvalRect (&whichWindow->portRect);
- ResizeContent ();
- ResizeScrollBars ();
- }
- } /*DoZoom*/
-